<template>
	<view class="bg-white p-2 flex" @click="onclick">
		<view class="position-relative">
			<image mode="widthFix" style="height: 96rpx;width: 96rpx;" :src="item.avatar"></image>
			<chat-bagde  v-if="item.noreadNum > 0" :Num="item.noreadNum" badgeClass="position-absolute" badgeStyle="right: -10rpx;top:-10rpx"></chat-bagde>
		</view>
		<view class="flex flex-column flex-1 justify-between ml-2">
			<view class="flex justify-between ">
				<text class="font-md">{{item.name}}</text>
				<text class="font-sm text-light">{{item.newsTime | formatTime}}</text>
			</view>
			<text class="font-sm">{{item.message}}</text>
		</view>
	</view>
</template>

<script>
	import chatBagde from '@/components/chat/chat-bagde.vue';
	import $Time from "@/common/js/time.js"
	export default {
		components:{
			chatBagde
		},
		filters: {
			formatTime(value) {
				return $Time.gettime(value);
			}
		},
		props: {
			// 聊天对象数据集合
			item: Object,
			// 索引
			index:Number
		},
		methods:{
			onclick(){
				// 跳转到聊天
				uni.navigateTo({
					url: '/pages/news/chat/chat'
				});
			},
		}
	}
</script>

<style>
</style>
